home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Inne
/
Gry
/
Carnage_Contest
/
scripts
/
CC Original
/
tools
/
Bar.lua
next >
Wrap
Text File
|
2009-09-14
|
2KB
|
55 lines
--------------------------------------------------------------------------------
-- Weapon Bar
-- Original Carnage Contest Weapon
-- Script by DC, August 2009, www.UnrealSoftware.de
--------------------------------------------------------------------------------
-- Setup Tables
if cc==nil then cc={} end
cc.bar={}
cc.bar.gfx_wpn={}
-- Load & Prepare Ressources
for i=0,3,1 do
cc.bar.gfx_wpn[i]=loadgfx("buildings/bar"..i..".bmp") -- Weapon Image
setmidhandle(cc.bar.gfx_wpn[i])
end
cc.bar.sfx_build=loadsfx("buildmetal.ogg") -- Build Sound
--------------------------------------------------------------------------------
-- Weapon: Bar
--------------------------------------------------------------------------------
cc.bar.id=addweapon("cc.bar","Bar",cc.bar.gfx_wpn[0],3) -- Add Weapon (3 uses)
function cc.bar.draw() -- Draw
if weapon_shots==0 then
-- HUD Positioning
hudpositioning(pos_build,cc.bar.gfx_wpn[weapon_mode])
-- HUD Info
hudinfo("Press [Space] to rotate the bar!")
end
end
function cc.bar.attack(attack) -- Attack
if weapon_timer>0 then
weapon_timer=weapon_timer-1
end
if (weapon_shots<=0) and (attack==1) and (weapon_timer==0) then
-- Rotate
weapon_timer=15
weapon_mode=weapon_mode+1
if weapon_mode>3 then
weapon_mode=0
end
end
if (weapon_shots<=0) and (weapon_position==1) then
-- Use weapon and allow to use another one afterwards (1)
useweapon(1)
weapon_shots=weapon_shots+1
-- Draw
terrainimage(cc.bar.gfx_wpn[weapon_mode],weapon_x,weapon_y)
-- Sound
playsound(cc.bar.sfx_build)
end
end